<p id="notallowed" style="color:#ff0000; font-weight:bold; text-align:center;"></p> 
<p style="color:#db3939; font-style:normal;  text-align:center; font-size:12px;/* display:inline;*/   background:#0f2; color:#fff; padding:5px 5px; border:1px solid #cdcdcd; width:200px; clear:left; margin:10px auto" class="evalComplete"></p>

<h2><%=t('welcome.filter_examinees')%>:</h2>

<div class="formContainer" style="position:relative;">
    
	 <% if current_user.role_id == 1 or current_user.role_id == 2%>
	 
	   <% form_tag evaluate_path,:method=>"get", :remote=>true,:id=>"class_form", :class=>"assign_examinee" do -%>
            <%=hidden_field_tag "flag",'e'%>
			<table class="formTable" style="border:0px;">
            <tr>
            <td> 
           <div style="float:left; padding:0px; margin:0 20px 0 0;">
		   <label style="float:left; padding-right:10px; width:120px;"><%=t('general.select_cat')%>: </label>
		   <%= select_tag "examCategory",options_for_select([[t('general.select') , "" ]] + @c.collect{|p| [p.gathercat(p),p.id,{:title=>p.gathercat(p)}]},:selected=>@category_id), {:id=>"examCategory", :class=>"category w530 bdr validate[required]"} %>
		   </div>
		   <div class="clear"></div><br>
		   		   
	       <div style="float:left; padding:0px; margin:0; clear: left;">
		   <label style="float:left; padding-right:10px; width:120px;"><%=t('exam.year')%>:</label>
		   <%= select_tag 'academicYear', options_for_select(([[t('general.select'),""]] + @yrs.to_a),:selected=>@academicYear),:class=>"validate[required] w120 bdr" %>		   
		   </div>
		   <div class="clear"></div><br>		   

			<div style="float:left; padding:0px; margin:0; clear: left;">
			<label style="float:left; padding:3px 10px 0 0; width:120px;"><%=t('general.examtype')%>:</label>
			<%= select_tag 'examtype',options_for_select([[t('general.select'),""]] + @examTypes.collect{|p| [truncate(p.name,:length=>30),p.id,{:title=>p.name}]},:selected=>@examtype), {:style=>"width: 200px; height: 19px; border: 1px solid rgb(209, 209, 209);",:class=>"validate[required]"} %>
            </div>
			<div class="clear"></div><br>

			<div style="float:left; padding:0px; margin:0; clear: left;">
			<label style="float:left; padding:3px 10px 0 0; width:120px;">Exam:</label>
			<%= select_tag 'exam',options_for_select([[t('general.select'),""]] + @exam.collect{|p| [truncate(p.name,:length=>30),p.id,{:title=>p.name}]},:selected=>@examname), {:style=>"width: 200px; height: 19px; border: 1px solid rgb(209, 209, 209);",:class=>"validate[required]"} %>
            </div>			
            </td> 
			</tr> 
            </table>
			<%= submit_tag t('general.filter'), :id=>"assign", :class=>'btnBg' %>
	  <%end%>
	
	<%elsif current_user.role_id == 3 %>
	 
	  <% form_tag evaluate_path,:method=>"get", :remote=>true,:id=>"class_form", :class=>"assign_examinee" do -%>
            <%=hidden_field_tag "flag",'e'%>
			<table class="formTable" style="border:0px;">
            <tr>
            <td> 
           <div style="float:left; padding:0px; margin:0 20px 0 0;">
		   <label style="float:left; padding-right:10px; width:120px;"><%=t('general.select_cat')%>: </label>
		   <%= select_tag "examCategory",options_for_select([[t('general.select') , "" ]] + @evaluatorExams.collect{|e| [e.evalCategory(e),e.categoryId(e),{:title=>e.evalCategory(e)}]}), {:id=>"examCategory", :class=>"category w530 bdr validate[required]"} %>
		   </div>
		   <div class="clear"></div><br>
		   		   
	       <div style="float:left; padding:0px; margin:0; clear: left;">
		   <label style="float:left; padding-right:10px; width:120px;"><%=t('exam.year')%>:</label>
		   <%= select_tag 'academicYear', options_for_select(([[t('general.select'),""]] + @yrs.to_a),:selected=>@academicYear),:class=>"validate[required] w120 bdr" %>		   
		   </div>
		   <div class="clear"></div><br>		   

			<div style="float:left; padding:0px; margin:0; clear: left;">
			<label style="float:left; padding:3px 10px 0 0; width:120px;"><%=t('general.examtype')%>:</label>
			<%= select_tag 'examtype',options_for_select([[t('general.select'),""]] + @examTypes.collect{|p| [truncate(p.name,:length=>30),p.id,{:title=>p.name}]},:selected=>@examtype), {:style=>"width: 200px; height: 19px; border: 1px solid rgb(209, 209, 209);",:class=>"validate[required]"} %>
            </div>
			<div class="clear"></div><br>

			<div style="float:left; padding:0px; margin:0; clear: left;">
			<label style="float:left; padding:3px 10px 0 0; width:120px;">Exam:</label>
			<%= select_tag 'exam',options_for_select([[t('general.select'),""]] + @exam.collect{|p| [truncate(p.name,:length=>30),p.id,{:title=>p.name}]},:selected=>@examname), {:style=>"width: 200px; height: 19px; border: 1px solid rgb(209, 209, 209);",:class=>"validate[required]"} %>
            </div>			
            </td> 
			</tr> 
            </table>
			<%= submit_tag t('general.filter'), :id=>"assign", :class=>'btnBg' %>
	  <%end%>	
	
	<%end%>

	
<fieldset class="rightNav examineesOuter" style="position:absolute; top:0; right:-225px; width: 200px; height: 198px; border: 1px solid rgb(209, 209, 209); padding: 5px; margin-top:1px\0/; overflow-x: hidden; overflow-y:auto;">
<legend><%=t('user.examinees')%></legend>
		<span id="examinees"><%=render :partial=>"examinees"%></span>
</fieldset>


</div>


<div id="userQuestions">

	<%=render :partial=>"userQuestions"%>

</div>


<script type="text/javascript">	

$(document).ready(function() {
	
$("#formID1").validationEngine();
$('.showComment').hide();
$('.evalComplete').hide();
				$("#examCategory, #academicYear, #examtype").change(function(){
				//var thischeck = $(this);
				 var target = '<%= url_for(getCategoryexams_path)%>';
				 
				 var data = {category_id:$("#examCategory").val(), year:$("#academicYear").val(),examtype_id:$("#examtype").val()};
				$.get(target, data, function(data){
					var arr = data.examNames
					$("#exam").empty(); 
					$("#exam").append("<option value=" + "" + ">" + "<%=t('general.select')%>" + "</option>");
				 jQuery.each(arr, function(index, value) {
					$("#exam").append("<option title='"+value.exam.name+"' value=" + value.exam.id + ">" + value.exam.name + "</option>");
				    });
                   }, 'json')
               });
			   
		
	$("#userQuestions .pagination a").live("click", function(){
	var link = this.href
	var lastChar = link.substr(link.length - 1);	
	if (lastChar == '#'){
		return false;
	}
	else{
		$.getScript(this.href);
		return false;
	}	
	//$.getScript(this.href);
	//return false;
   });
		
		
  });
</script>